From: Florian Müllner Date: Wed, 4 Feb 2026 13:12:25 +0000 (+0100) Subject: swipeTracker: Handle invalid position when finding previous point X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~39^2~1^2~5 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=eb9caf0028be0d5740fc419e7e865584c0f52cab;p=gnome-shell.git swipeTracker: Handle invalid position when finding previous point Commit 8e29babca8adc677 switched to `findLastIndex()` to find the previous point, which inadvertently changed what value is returned for invalid input. Restore the old fallback value and log a stacktrace, so we can hopefully track down what causes the invalid input. Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8856 Part-of: --- diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js index c21d51e65..05b5b2cc6 100644 --- a/js/ui/swipeTracker.js +++ b/js/ui/swipeTracker.js @@ -523,7 +523,14 @@ export const SwipeTracker = GObject.registerClass({ } _findPreviousPoint(pos) { - return this._snapPoints.findLastIndex(p => p <= pos); + const index = + this._snapPoints.findLastIndex(p => p <= pos); + if (index !== -1) + return index; + + console.trace(`Invalid position ${pos}`); + // also out-of-bounds, but somehow callers fail less hard than with -1 + return this._snapPoints.length; } _findPointForProjection(pos, velocity) {